<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorate="main">
<head>
    <meta charset="UTF-8">
    <title>角色修改</title>
    <link th:href="@{/localcss/add.css}" href="../static/localcss/add.css" rel="stylesheet">
</head>
<body>
<div layout:fragment="content">
    <div class="clearfix"></div>
    <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="x_panel">
                <div class="x_title">
                    <h2>修改角色信息 <i class="fa fa-user"></i></h2>
                    <div class="clearfix"></div>
                </div>
                <div class="x_content">
                    <div class="clearfix"></div>
                    <form class="form-horizontal form-label-left" action="/role/save" method="post" th:action="@{/role/save}">

                        <input type="hidden" name="roleId" th:value="${role.roleId}">

                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">角色名称 <span class="required">*</span>
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <input id="roleName" class="form-control col-md-7 col-xs-12"
                                       data-validate-length-range="20" data-validate-words="1" name="roleName"  required="required"
                                       placeholder="请输入角色名称" type="text" th:value="${role.roleName}">
                            </div>
                        </div>
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">角色描述
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <textarea name="roleDesc" id="roleDesc" class="form-control col-md-7 col-xs-12" rows="5"  placeholder="请输入角色描述" th:value="${role.roleDesc}"></textarea>
                            </div>
                        </div>

                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">角色状态 <span class="required">*</span>
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <input type="checkbox" name="roleFlag" value="1" th:checked="${role.roleFlag==1}"/>(选中可用）
                            </div>
                        </div>
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="name">角色权限 <span class="required">*</span>
                            </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <ul>
                                    <li th:each="right1 : ${rights}" th:if="${right1.rightType == 'Folder'}">
                                        <a>
                                            <input type="checkbox" name = "rightCode" th:value="${right1.rightCode}">
                                            <span th:text="${right1.rightText}">一级菜单</span>
                                            <span class="fa fa-chevron-down"></span>
                                        </a>
                                        <ul>
                                            <li th:each="right2 : ${rights}" th:if="${right2.rightType == 'Document' && right2.rightParentCode == right1.rightCode}">
                                                <a >
                                                    <input type="checkbox" name = "rightCode" th:value="${right2.rightCode}">
                                                    <span th:text="${right2.rightText}">二级菜单</span>
                                                </a>
                                            </li>
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="ln_solid"></div>
                        <div class="form-group">
                            <div class="col-md-6 col-md-offset-3">
                                <button id="send" type="submit" class="btn btn-success">保存</button>
                                <button type="button" class="btn btn-primary" id="back">返回</button>
                                <br/><br/>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script layout:fragment="js">
    $(document).ready(function(){
        $("#back").on("click",function(){
            window.history.back();
        })
    });
</script>
</html>
